package com.xueqiu.lovepetmedicalmanagersystem.service.Impl;

import com.xueqiu.lovepetmedicalmanagersystem.mapper.PetTypesMapper;
import com.xueqiu.lovepetmedicalmanagersystem.pojo.PetTypes;
import com.xueqiu.lovepetmedicalmanagersystem.service.PetTypesService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @author xueqiu
 */
@Service
public class PetTypesServiceImpl implements PetTypesService {

    @Autowired
    private PetTypesMapper petTypesMapper;

    /**
     * 根据宠物类型ID查询单个宠物类型
     * @param petTypeId 宠物类型ID
     * @return 宠物类型对象；可能找不到为NULL
     */
    @Override
    public PetTypes getPetType(Integer petTypeId) {
        return petTypesMapper.queryPetType(petTypeId);
    }

    /**
     * 查询所有宠物类型
     * @return 宠物类型对象列表；可能找不到为EMPTY
     */
    @Override
    public List<PetTypes> getPetTypes() {
        return petTypesMapper.queryAllPetTypes();
    }

    /**
     * 根据宠物类型名称查询单个宠物类型；前提是宠物类型名称无重复
     * @param typeName 宠物类型名称
     * @return 宠物类型对象；可能找不到为NULL
     */
    @Override
    public PetTypes getPetTypeByName(String typeName) {
        return petTypesMapper.queryPetTypeByName(typeName);
    }
}
